<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
<head>
<title></title>
<meta charset="utf-8">
<meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<meta name="copyright" content="http://www.appcms.org" />
<link rel="stylesheet" href="skin/base.css">
<link rel="stylesheet" href="skin/index.css">
<script src="js/zy_control.js"></script>
<script src="js/zy_click.js"></script>
<script src="js/zy_slide.js"></script>
<script src="js/config.js"></script>
<script src="js/common.js"></script>
</head>
<body>
<div id="main"  class="loading"> </div>
</body>
<script>
	zy_init();
	var isslider = true;
	function getMain(t){
		var url = app_path+'index.php?m=iapp&c=app&a=init&siteid=1&t='+t;	
		uexXmlHttpMgr.open(t,'get',url,"8000");
		uexXmlHttpMgr.send(t);
	}

	window.uexOnload=function(type){
		if(!type){
			uexWindow.setBounce("1");			
			uexWindow.setBounceParams("0",'{"imagePath":"res://loading.png","textColor":"#666","levelText":"","pullToReloadText":"拖动刷新","releaseToReloadText":"释放刷新","loadingText":"加载中，请稍等"}');
			uexWindow.showBounceView("0","#f3f3f3","1");
			uexWindow.notifyBounceEvent("0","1");
			uexWindow.onBounceStateChange=function(t,s){
　　　　　　		if(t=="0"){
　　　　　　　　		if(s=="2"){
						getMain(t);						
					}
　　　　　　		}
            }
			
			uexXmlHttpMgr.onData = function(opId, status, data){	
					if(status==1){
						$$('main').className = '';
						uexWindow.setBounceParams("0",'{"imagePath":"res://loading.png","textColor":"#666","levelText":"上次更新：'+Now()+'","pullToReloadText":"拖动刷新","releaseToReloadText":"释放刷新","loadingText":"加载中，请稍等"}');
						uexXmlHttpMgr.close(opId);
						uexWindow.resetBounceView(0);
						data=JSON.parse(data);
						data=data['data'];
						
						if(opId==-1){
							//localStorage['config'] = data['config'];
							
					    	var html = '<div id="focuspic">'+
  								'<div id="slider" class="box-hor box"> </div>'+
	                            '<div id="switch" class="t-c"> </div>'+
                                '</div>'+
                                '<div class="ma">';
								
								for (k in l_index) {
									html += '<div onclick="open_index(\''+k+'\');" class="div"><div><img src="skin/images/icon/'+k+'.png" style="background-color:'+l_index[k]['bg']+'" ><span>'+l_index[k]['title']+'</span></div></div>';
								}
								
								html +='</div>'+
								'<div id="headlines"></div>';
								
								/*
								html +='</div>'+
								'<div class="mb">'+
								'<div id="img" class="loadimg"></div>'+
								'</div>'+
								'<div id="headlines"></div>'+
								'<div class="mc" id="headlines">'+
								'  <div class="l"><img src="skin/images/common/jrrd.png" ></div>'+
								'  <div class="r"><strong id="headlines_title"></strong>'+
								'  <p id="headlines_des"></p>'+
								'  </div>'+
								'</div>';
								*/
						
							$$('main').innerHTML= html;
						}
						
						if(data){
							var slide = data['slide'];
							var html='';
							var Em='';
							
							for (i=0; i<slide.length; i++) {
								var _s = '';
								if(slide[i]['id']!='0'){
									_s=' ontouchstart="zy_touch(\'down\')"'; 
								}
								html+='<div class="loadimg" '+_s+'>';
								html+='<img src="'+slide[i]['img']+'" onclick="jump(\''+slide[i]['type']+'\',\''+slide[i]['id']+'\',\''+slide[i]['catid']+'\')" class="hide" onload="this.className=\'\'" />';
								html+='</div>';	
															
								var _e = '';
								if(i==0){
									_e=' class="focus"'; 
								}
								Em+='<em '+_e+'></em>';
							}
							$$('slider').innerHTML= html;
							$$('switch').innerHTML= Em;
							
							if (isslider) {
								zy_slide();
								isslider = false;
							}
							/*
							var img = data['img'];
							$$('img').innerHTML='<img src="'+img['thumb']+'" class="hide" onload="this.className=\'\'">';
							$$('img').setAttribute("onclick", "javascript:jump('"+img['type']+"','"+img['id']+"','"+img['catid']+"','"+img['title']+"');");
							
							*/
							
							var headlines = data['headlines'];
							
							/*						
							$$('headlines_title').innerHTML=headlines['title'];
							$$('headlines_des').innerHTML=headlines['description'];
							$$('headlines').setAttribute("onclick", "javascript:jump('"+headlines['type']+"','"+headlines['id']+"','"+headlines['catid']+"','"+headlines['title']+"');");
							
							*/
							
							var head = '';
							for (k in headlines) {
									
								head += '<div class="mc" ontouchstart="zy_touch(\'act\')" onclick="jump(\''+headlines[k]['type']+'\',\''+headlines[k]['id']+'\',\''+headlines[k]['catid']+'\');">'+
								'  <div class="txt"><strong>'+headlines[k]['title']+'</strong>'+
								'  <p>'+headlines[k]['description']+'</p>'+
								'  </div>'+
								'  <div class="img"><img src="'+headlines[k]['thumb']+'" ></div>'+
								'</div>';
							}
							$$('headlines').innerHTML=head;
						}
						
					}else if(status==-1){//加载失败
						uexXmlHttpMgr.close(opId);
						uexWindow.resetBounceView(0);
						$$('main').className = 'errer';
						uexWindow.toast("0","5",'加载失败',1000);
					}
			}
			
			getMain(-1);
		}
	}

	function jump(t,id,catid){
		if(t=='news'||t=='picture'||t=='video' || t=='company' || t=='talk'){			
			localStorage[t+'_id']=id;
			localStorage[t+'_catid']=catid;
			uexWindow.open(t+'_show','0',t+'_show.html','2','', '',4);
		}else if(t=='apps'){
			uexWindow.open('apps_'+id,'0','apps/'+id+'/index.html','2','', '',0);
		}else if(t=='url'){
			localStorage['browserurl']=id;
			uexWindow.open('browser','0','browser.html','2','', '',4);
		}
	}
	
	function open_index(k){
		if(l_index[k]['catid']>0){
			localStorage[l_index[k]['url']+'_catid']=l_index[k]['catid'];
		}

		if(l_index[k]['model']=='content'||l_index[k]['model']=='life'){
			localStorage[l_index[k]['model']+'_tab']=l_index[k]['url'];
			uexWindow.open(l_index[k]['model'],0,l_index[k]['model']+'.html',2,'','',4);
		}else if(l_index[k]['model']=='app'){
			uexWindow.open(l_index[k]['model'],0,'apps/'+l_index[k]['model']+'/index.html',2,'','',4);
		}else if(l_index[k]['model']=='url'){
			localStorage['browserurl']=l_index[k]['url'];
			uexWindow.open('browser','0','browser.html','2','', '',4);
		}else{
			uexWindow.open(l_index[k]['model'],0,l_index[k]['model']+'.html',2,'','',4);
		}
	}

	</script>
</html>